﻿
@{
    ViewBag.Title = "管理员管理";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section styles{
    <link href="~/bootstrap/plugins/bootstrap-table/bootstrap-table.css" rel="stylesheet" />
}

@section scripts{
    <script type="text/javascript" src="~/bootstrap/plugins/bootstrap-table/bootstrap-table.js"></script>
    <script src="~/bootstrap/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>

    <script src="~/js/admin.js?v=2.0"></script>
    <script type="text/javascript">
        var $table = $("#bsTable");
        $(function () {
            $table.bootstrapTable({
                url: "@Url.Action("GetList")",
                pagination: true,
                pageSize: 10,
                singleSelect: true,//复选框只能选中一个
                clickToSelect: true,//单击行勾选复选框
                queryParams: queryParams
            });
        });

        function queryParams(params) {
            console.log(params);
            return {
                PageIndex: params.offset / params.limit + 1,
                PageSize: params.limit,
                Key: $("#Key").val()
            };
        }

        function Search() {
            $table.bootstrapTable("refreshOptions", {
                pageNumber: 1,
                queryParams: queryParams
            });
        }
        function editFormatter(value, row, index) {
            return '<a href="@Url.Action("Edit")/' + value + '" class="btn btn-xs green"><i class="fa fa-edit"></i> 修改 </a>';
        }


        function Remove() {
            admin.Del('@Url.Action("Remove")', Search);
        }

    </script>

}

<ul class="page-breadcrumb breadcrumb">
    <li>
        <a href="#">
            管理员管理
        </a>
    </li>
</ul>

<div class="row">
    <div class="col-md-12">

        <div class="portlet-body">
            <div class="row">
                <div class="form-group">
                    <div class="col-sm-8">
                        <div class="btn-group btn-group-solid">
                            <a href="@Url.Action("Create")" class="btn green" role="button" title="添加"><i class="fa fa-plus"></i> 添加</a>
                            <a href="javascript:void(0);" onclick="Remove();" class="btn yellow" role="button" title="删除"><i class="fa fa-times"></i> 删除</a>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="input-group">
                            <div>
                                <input id="Key" class="form-control" type="text" placeholder="账号，姓名" />
                            </div>
                            <span class="input-group-btn">
                                <button class="btn btn-success" onclick="Search();" type="button"><i class="fa fa-search"></i> 查询</button>
                            </span>
                        </div>
                    </div>
                </div>
            </div><br />
            <table id="bsTable">
                <thead>
                    <tr>
                        <th data-checkbox="true"></th>
                        <th data-field="user_no">账号</th>
                        <th data-field="user_name">姓名</th>
                        <th data-field="role_name">角色</th>
                        <th data-field="create_time" data-formatter="ymdDateFormatter">创建时间</th>
                        <th data-field="last_logintime" data-formatter="ymdhmsDateFormatter">最后登录时间</th>
                        <th data-field="is_enable" data-formatter="enableFormatter">状态</th>
                        <th data-field="id" data-formatter="editFormatter">修改</th>
                    </tr>
                </thead>
            </table>
        </div>
    </div>
</div>


